package com.hzz.framework.config;


import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@ConfigurationProperties(prefix = "spring.datasource")
@Data
@Configuration
public class DataSourceProperties {
    String driverClassName;
    String url;
    String username;
    String password;
    //下面为连接池的补充设置，应用到上面所有数据源中
    //初始化大小，最小，最大
    Integer initialSize;// = 5;
    Integer minIdle;// = 5;
    Integer maxActive;// = 20;
    //配置获取连接等待超时的时间
    Integer maxWait;// = 60000;
    //配置间隔多久才进行一次检测，检测需要关闭的空闲连接，单位是毫秒
    Integer timeBetweenEvictionRunsMillis;// = 300000;
    //配置一个连接在池中最小生存的时间，单位是毫秒
    Integer minEvictableIdleTimeMillis;// = 600000;
    String validationQuery;// = "select 1 ";
    Boolean testWhileIdle;// = true;
    Boolean testOnBorrow;// = false;
    Boolean testOnReturn;// = false;
    //打开PSCache，并且指定每个连接上PSCache的大小
    Boolean poolPreparedStatements;// = true;
    Integer maxPoolPreparedStatementPerConnectionSize;// = 20;
    //配置监控统计拦截的filters，去掉后监控界面sql无法统计，'wall'用于防火墙
    String filters;// = "stat,wall,slf4j";
    //通过connectProperties属性来打开mergeSql功能；慢SQL记录
    String connectionProperties;// = "druid.stat.mergeSql:true;druid.stat.slowSqlMillis:5000";
    //合并多个DruidDataSource的监控数据
    Boolean useGlobalDataSourceStat;// = true;
}
